Skip to content

Conversation

aescolar
Copy link
Member

@aescolar aescolar commented Oct 6, 2025

Zephyr's socklen_t was changed in
c546c1c
to be uint32_t instea of size_t.
Let's fix accordingly the prototypes which expect it.

Related to:

zsock_recvfrom() takes as last argument a socklen_t pointer
which type was changed in
c546c1c
as is not anymore equivalent to size_t.
So let's ensure we pass the right type of pointer to it.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
net_tcp_accept_cb_t takes a socklen_t as 3rd argument,
which type was changed in
c546c1c
and is not anymore equivalent to size_t.
So let's correct it.

As a freebie, let's define that function as static as it is.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
@aescolar aescolar requested review from jukkar and rlubos October 6, 2025 10:44
@aescolar aescolar marked this pull request as ready for review October 6, 2025 10:55
@zephyrbot zephyrbot added area: Sockets Networking sockets area: Wi-Fi Wi-Fi area: Tracing Tracing area: Tests Issues related to a particular existing or missing test area: Networking labels Oct 6, 2025
pdgendt
pdgendt previously approved these changes Oct 6, 2025
jukkar
jukkar previously approved these changes Oct 6, 2025
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I wonder why these were not found out as part of the original PR.

rlubos
rlubos previously approved these changes Oct 6, 2025
zsock_getsockopt() takes as last argument a socklen_t pointer
which type was changed in
c546c1c
as is not anymore equivalent to size_t.
So let's ensure we pass the right type of pointer to it.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Zephyr's socklen_t was changed in
c546c1c
to be uint32_t instea of size_t.
Let's fix accordingly the prototypes which expect it.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
zsock_recvfrom() takes as last argument a socklen_t pointer
( c546c1c )
whose definition has changed.
So let's ensure we pass the right type of pointer to it.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
@aescolar aescolar dismissed stale reviews from rlubos, jukkar, and pdgendt via 4576591 October 6, 2025 11:22
@aescolar
Copy link
Member Author

aescolar commented Oct 6, 2025

Two more fixes after running a full twister run on native_sim//64 locally.

Thanks, I wonder why these were not found out as part of the original PR.

PRs run only a subset of tests, and unfortunately issues get past sometimes :(

@zephyrbot zephyrbot requested a review from BeckmaR October 6, 2025 11:24
Copy link

sonarqubecloud bot commented Oct 6, 2025

void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr,
size_t len, int val, void *data)
static void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr,
socklen_t len, int val, void *data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint32_t is sufficient to represent any socket length, so rather than mixing up POSIX in drivers, I would suggest sticking to fixed-width integer types. That also mirrors what is done in the network subsystem.

Suggested change
socklen_t len, int val, void *data)
uint32_t len, int val, void *data)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is used as a callback of type net_tcp_accept_cb_t. This is just the signature of that type.
I agree that using socklen_t in drivers is not nice, but to change that we'd need to change that callback type and all other users.
But this PR is just an immediate fix for the CI issue.

struct net_buf *dns_data = NULL;
struct sockaddr addr;
size_t addrlen;
socklen_t addrlen;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
socklen_t addrlen;
uint32_t addrlen;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pointer type zsock_recvfrom() expects.
Note socklen_t is already used in this same function.

@jukkar jukkar added the Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. label Oct 6, 2025
@jhedberg jhedberg merged commit 1264a92 into zephyrproject-rtos:main Oct 6, 2025
33 checks passed
@aescolar aescolar deleted the fix_socketlen branch October 6, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: Sockets Networking sockets area: Tests Issues related to a particular existing or missing test area: Tracing Tracing area: Wi-Fi Wi-Fi Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants